from django.db import models


# 班级表，学校定时更新到服务器的数据表
class Bjb(models.Model):
    class_code = models.CharField(verbose_name='班级代码', max_length=100, primary_key=True, db_column='bjbm')
    class_name = models.CharField(verbose_name='班级名称', max_length=50, db_column='bjmc')
    faculty_code = models.CharField(verbose_name='院系代码', default='', max_length=30, db_column='yxdm')
    major_code = models.CharField(verbose_name='专业代码', default='', max_length=50, db_column='zybm')
    grade_name = models.CharField(verbose_name='所属年级', max_length=100, db_column='ssnj')
    campus = models.CharField(verbose_name='所在校区', max_length=20, db_column='xq')
    class_type = models.CharField(verbose_name='班级层次', max_length=100, db_column='bjcc')

    class Meta:
        db_table = 't_zlsjts_qtxsbjxx'
        app_label = 'dgut'
        managed = False  # 不用做migrate
        verbose_name_plural = verbose_name = '学校班级表'


# 班级表
class Classes(models.Model):
    class_code = models.CharField(verbose_name='班级代码', max_length=100, primary_key=True)
    class_name = models.CharField(verbose_name='班级名称', max_length=50)
    faculty_code = models.CharField(verbose_name='院系代码', default='', max_length=30, null=True)
    major_code = models.CharField(verbose_name='专业代码', default='', max_length=50, null=True)
    grade_name = models.CharField(verbose_name='所属年级', max_length=100, null=True)
    campus = models.CharField(verbose_name='所在校区', max_length=20, null=True)
    class_type = models.CharField(verbose_name='班级层次', max_length=100, null=True)

    class Meta:
        db_table = 'classes'
        verbose_name_plural = verbose_name = '班级表'


# 专业表，学校定时更新到服务器的数据表
class Zyb(models.Model):
    major_code = models.CharField(verbose_name='专业编号', primary_key=True, max_length=30, db_column='zybm')
    major_title = models.CharField(verbose_name='专业名称',  max_length=50, db_column='zymc')
    faculty_code = models.CharField(verbose_name='院系编号',  max_length=30, db_column='yxdm')

    class Meta:
        db_table = 't_zlsjts_qtxszyxx'
        app_label = 'dgut'
        managed = False  # 不用做migrate
        verbose_name_plural = verbose_name = '学校专业表'


# 专业表
class Major(models.Model):
    major_code = models.CharField(verbose_name='专业编码', max_length=30)
    major_title = models.CharField(verbose_name='专业名称', max_length=50)
    faculty_code = models.CharField(verbose_name='院系编码', null=True, max_length=30)

    class Meta:
        db_table = 'major'
        verbose_name_plural = verbose_name = '专业表'


# 组织部门表，学校定时更新到服务器的数据表
class Zzbmb(models.Model):
    faculty_code = models.CharField(verbose_name='单位码', primary_key=True, max_length=30, db_column='dwm')
    faculty_title = models.CharField(verbose_name='单位名称',  max_length=100, db_column='dwmc')
    parent_code = models.CharField(verbose_name='上级单位号', null=True, max_length=30, db_column='lsdwm')

    class Meta:
        managed = False  # 不用做migrate
        db_table = 't_zlsjts_yxsdwxx'
        app_label = 'dgut'
        verbose_name_plural = verbose_name = '学校组织部门表'


# 组织部门表
class Faculty(models.Model):
    faculty_code = models.CharField(verbose_name='单位号', max_length=30)
    faculty_title = models.CharField(verbose_name='单位名称', max_length=50)
    parent_code = models.CharField(verbose_name='上级单位号', null=True, max_length=30)

    class Meta:
        db_table = 'faculty'
        verbose_name_plural = verbose_name = '组织部门表'